//
//  HYLTitleView.swift
//  iOSwechat
//
//  Created by apple on 16/3/1.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class HYLTitleView: UIButton {

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    init(title : String){
        super.init(frame: CGRectZero)
        
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        self.setImage(UIImage(named: "navigationbar_arrow_up"), forState: UIControlState.Normal)
        self.sizeToFit()
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        
        // 交换title 和 image
        titleLabel?.frame.origin.x = 0
        
        imageView?.frame.origin.x = (titleLabel?.frame.size.width)! + 5
        
    }
    
    
}
